/*
 	8选7改进算法
 */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(){
	int i,num[7] ={};
	srand(time(0));
	int arr[8];
	for(i = 0;i < sizeof(num)/sizeof(num[0]);i++){
		arr[i] = i + 1;
	}	
	for(i = 0;i < sizeof(num)/sizeof(num[0]);i++){
		int index = rand() % (8 - i);//随机
		num[i] = arr[index];//
		arr[index] = arr[8 - 1 - i];//
	}
	for(i = 0;i < sizeof(num)/sizeof(num[0]);i++){
		printf("%d ",num[i]);
	}
	printf("\n");
	return 0;
}
